package work.konbai.finance.feign;

import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import work.konbai.finance.entity.Account;
import work.konbai.finance.service.IAccountService;

import java.util.List;

/**
 * @author KonBAI
 * @version 1.0
 * Create by 2021/4/2 10:32
 */
@RestController
@AllArgsConstructor
public class AccountClient implements IAccountClient{

	private final IAccountService accountService;

	@Override
	@GetMapping(API_PREFIX + "/all-account")
	public R<List<Account>> allAccounts() {
		return R.data(accountService.list(Condition.<Account>getLambdaQueryWrapper()
			.select(Account::getId, Account::getAccountName)));
	}
}
